package com.glodon.paas.document.dao.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.glodon.paas.document.api.bean.ProjectMemberAttendees;
import com.glodon.paas.document.service.util.DocumentBuilder;
import com.glodon.paas.util.BeanFactoryUtil;
import com.google.code.morphia.annotations.Id;

public class ProjectMemberAttendeesEntity {
    public static DocumentBuilder builder = null;
    public static ProjectMemberAttendees getDto(ProjectMemberAttendeesEntity e) {
        return getDto(e,false);
    }
    public static ProjectMemberAttendees getDto(ProjectMemberAttendeesEntity e,boolean cascade) {
        if (e == null) {
            return null;
        } else {
            ProjectMemberAttendees d = new ProjectMemberAttendees();
            d.setId(e.getId());
            d.setMemberId(e.getMemberId());
            d.setStatus(e.getStatus());
            d.setEditable(e.getEditable());
            d.setCreateTime(e.getCreateTime());
            d.setUpdateTime(e.getUpdateTime());
            d.setUserId(e.getUserId());
            d.setCreator(e.getCreator());
            d.setUpdator(e.getUpdator());
            d.setInvitationId(e.getInvitationId());
            if (cascade) {
                if (builder == null) {
                    builder = BeanFactoryUtil.getBean(DocumentBuilder.class);
                }
                d.setOwner(builder.buildUser(e.getUserId()));
            }
            return d;
        }
    }
    public static List<ProjectMemberAttendees> getDtos(List<ProjectMemberAttendeesEntity> es) {
        return getDtos(es,false);
    }
    public static List<ProjectMemberAttendees> getDtos(List<ProjectMemberAttendeesEntity> es,boolean cascade) {
        if (es == null) {
            return null;
        } else {
            List<ProjectMemberAttendees> ds = new ArrayList<ProjectMemberAttendees>(es.size());
            for (ProjectMemberAttendeesEntity e : es) {
                ds.add(getDto(e,cascade));
            }
            return ds;
        }
    }

    @Id
    private String id;
    private String memberId;
    private String userId;
    // -1:uninvited,0:invited;1:accepted;2:failed;3:rejected,4:removed;
    private int    status;
    private Date   createTime;
    private Date   updateTime;
    //0:editable,1:uneditable
    private int editable=0;
    private String creator;
    private String updator;
    private String invitationId;
    public String getCreator() {
        return creator;
    }
    
    public void setCreator(String creator) {
        this.creator = creator;
    }
    
    public String getUpdator() {
        return updator;
    }
    
    public void setUpdator(String updator) {
        this.updator = updator;
    }
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public int getEditable() {
        return editable;
    }
    
    public void setEditable(int editable) {
        this.editable = editable;
    }
    
    public String getMemberId() {
        return memberId;
    }
    
    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }
    
    public String getInvitationId() {
        return invitationId;
    }
    
    public void setInvitationId(String invitationId) {
        this.invitationId = invitationId;
    }
}
